package com.cc.config;


import com.cc.util.JwtUtil;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * @program:
 * @ClassName:
 * @description:
 * @author: zgc
 * @date:
 * @Version 1.0
 **/
@Configuration
public class WebConfig implements WebMvcConfigurer {

//    @Bean
//    @LoadBalanced
//    public CloseableHttpClient CloseableHttpClient(){
//        return HttpClientBuilder.create().build();
//    }
//    public RestTemplate restTemplate(){
//        return new RestTemplate();
//    }

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedMethods("GET", "POST", "DELETE", "PUT")
                .allowedHeaders("*")
                .exposedHeaders("*")
                .maxAge(3600);
    }
}
